<template>
  <div class="addModel">

    <Row :gutter="16" style="margin-bottom:10px">
       <Col span="6">入库单号：{{data.id}}</Col>
       <Col span="6">制单时间：{{data.createTime}}</Col>
       <Col span="6">入库方式：{{data.type}}</Col>
       <Col span="6">供应商：{{data.provider}}</Col>
    </Row>
    <Row :gutter="16" style="margin-bottom:10px">
       <Col span="6">备注：{{data.remark}}</Col>
       <Col span="6">制单人：{{data.username}}</Col>
    </Row>
    <Row :gutter="16">
      <i-table ref="table" border :content="self" :columns="columns" :data="data.list"></i-table>
    </Row>

  </div>
</template>

<script>
import hourse from "./../../api/hourse.js";
export default {
  name: "addModel",
  props:['data'],
  data() {
    return {
      self: this,
      columns: [
        {
          title: "序号",
          key: "id"
        },
        {
          title: "商品名称",
          key: "name"
        },
        {
          title: "单位",
          key: "unit"
        },
        {
          title: "生产厂商",
          key: "provider"
        },
        {
          title: "数量",
          key: "num",
        },
        {
          title: "零售价(￥)",
          key: "sellPrice"
        },
        {
          title: "成本价(￥)",
          key: "costPrice"
        },
        {
          title: "成本合计(￥)",
          key: "price",
          render: (h, { row }) => h("p", (row.num * row.costPrice).toFixed(2))
        },
        {
          title: "生产日期",
          key: "productTime",
          render: (h, { row }) => h("p", row.productTime.split(" ")[0])
        },
        {
          title: "过期时间",
          key: "overTime",
          render: (h, { row }) => h("p", row.overTime.split(" ")[0])
        }
      ]
    };
  },
  methods: {
    // submit() {
    //   hourse.drugAdd({ ...this.formItem, list: this.drugsInfo }).then(data => {
    //     if (data.flag) {
    //       this.$emit("changeLoading",false);
    //       this.drugsInfo = [];
    //       this.formItem = {
    //         type: "采购入库",
    //         provider: "",
    //         remark: ""
    //       };
    //       this.$Message.success('添加成功！')
    //     }else{
    //       this.$Message.success('添加失败！')
    //       this.$emit("changeLoading",true);
    //     }
    //   });
    // },
    // changeDrug(id) {
    //   hourse.drugSelect({ id }).then(data => {
    //     this.drugsInfo.push(data.data);
    //   });
    // }
  }
};
</script>

<style lang="less" scoped>
.addModel {
  .from {
    .item {
      margin-right: 15px;
    }
  }
}
</style>
